package com.huike.xingxing.application;

import android.app.Activity;
import android.app.Application;

import com.huike.xingxing.activity.BaseActivity;

import java.util.ArrayList;
import java.util.Iterator;

public class BaseApplicaton extends Application {

    private static BaseApplicaton instance;
    private ArrayList<Activity> list = new ArrayList<>();


    public static BaseApplicaton getInstance(){

        if (instance == null){
            instance = new BaseApplicaton();
        }
        return instance;
    }


    @Override
    public void onCreate() {
        super.onCreate();
    }

    public void addActivity(Activity activity){
        list.add(activity);
    }

    public void exitActivity(){

        if(list != null){
            for (Activity activity :list){
                activity.finish();
            }
        }
        android.os.Process.killProcess(android.os.Process.myPid());
        System.exit(0);

    }
}
